//
//  YZCClassificationCell.m
//  LOLerBox
//
//  Created by 杨智超 on 16/1/25.
//  Copyright © 2016年 蓝鸥科技. All rights reserved.
//

#import "YZCClassificationCell.h"
#import "YZCLiVedioCollectionViewCell.h"

#pragma mark - 签订协议
@interface YZCClassificationCell ()<UICollectionViewDataSource, UICollectionViewDelegate>

@end


@implementation YZCClassificationCell

- (void)awakeFromNib {
    // Initialization code
}

/* 初始化 */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
        
        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
        layout.itemSize = CGSizeMake(80, 100);
        layout.minimumInteritemSpacing = 1;
        layout.minimumLineSpacing = 1;
        /* 边界 */
//        layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
        
        self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:layout];
        /* 代理人 */
        self.collectionView.delegate = self;
        self.collectionView.dataSource = self;
        self.collectionView.backgroundColor = [UIColor cyanColor];
        
        /* 添加视图 */
        [self.contentView addSubview:self.collectionView];
        [_collectionView release];
        [layout release];
       
        /* 注册 */
        [self.collectionView registerClass:[YZCLiVedioCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
        
    }
    return self;
}






/* collectionView协议方法 */
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
   

   
//    if (self.dataArr.count == 0) {
//        return 1;
//    } else {
//
//        return self.dataArr.count;
//    }
    
    return self.dataArr.count;
   
}

/* cell设置 */
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    YZCLiVedioCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];

    return cell;
    
}



/* 布局方法 */
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.collectionView.frame = CGRectMake(10, 5, 355, 120);
}

/* set方法 */
- (void)setModel:(YZCVideoModel *)model {
    
    if (model != _model) {
        _model = model;
    }
    
}




- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
